//1:统一处理路径，参数，请求，请求头方式
//2:请求拦截器
//3:响应拦截器，对服务器返回状态码统一拦截，统一处理

let baseUrl = ""
baseUrl = process.env.VUE_APP_BASE_URL
console.log("运行环境", process.env.ENV_TYPE)
// 手机端app测试环境
// baseUrl = 'https://etaxtest.guangdong.chinatax.gov.cn/yyzcpt/backend/v1/grczw'

let header = {}
export default {
	postAwait(url, data) {
		return new Promise((resolve, reject) => {
			uni.request({
				data,
				url: baseUrl + url,
				method: 'post',
				header: {},
				sslVerify: false,
				withCredentials: true,
				success: (data) => {
					//做响应拦截
					resolve(data.data)
				},
				fail: (err) => {
					reject(err)
				}
			})
		})
	},
	getAwait(url, data) {
		return new Promise((resolve, reject) => {
			uni.request({
				data,
				url: baseUrl + url,
				method: 'get',
				header: header,
				success: (data) => {
					//做响应拦截
					resolve(data.data)
				},
				fail: (err) => {
					reject(err)
				}
			})
		})
	},
}